<template>
  <div class="container">
    <!-- 公告发布 -->
    <!-- 系统通知 -->
    <!-- 查询条件 -->
    <el-form :inline="true" class="tableSearchBox" size="medium">
      <el-form-item label="接收人：">
        <el-input v-model="search.name" placeholder="请输入接收人" clearable></el-input>
      </el-form-item>
      <el-form-item label="发送时间：">
        <el-date-picker v-model="search.time" type="daterange" value-format="yyyy-MM-dd" range-separator="至"
          start-placeholder="开始日期" end-placeholder="结束日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" @click="getData()">查询</el-button>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-plus">新增</el-button>
      </el-form-item>
    </el-form>
    <!-- /查询条件 -->
    <PagesTable :tableHeader="tableHeader" :tableData="tableData" :tableOperation="tableOperation"
      :tablePagination="tablePagination" @pageSize="pageSizeChange" @currentPage="currentPageChange"
      @pageOperation="handlePageOperation" />
  </div>
</template>

<script>
  import PagesTable from "../../components/PagesTable.vue";
  export default {
    components: {
      PagesTable
    },
    data() {
      return {
        search: { //搜索条件。
          name: "",
          time: ["", ""],
        },
        tableHeader: [{
            name: "序号",
            mark: "annid",
            minWidth: "90"
          },
          {
            name: "接收人",
            mark: "roleName",
            minWidth: "90"
          }, {
            name: "通知内容",
            mark: "content",
            minWidth: "90"
          },
          {
            name: "发送时间",
            mark: "publishTime",
            minWidth: "90"
          },

          // {
          //   name: "操作",
          //   mark: "",
          //   minWidth: "90"
          // },
        ],
        tableOperation: [{
            name: "编辑",
            mark: "edit",
            icon: true
          },
          {
            name: "删除",
            mark: "delete",
            icon: true
          },
        ],
        tablePagination: {
          show: true,
          current: 1,
          size: 10,
          total: 1
        },
        tableData: [{
          annid: 1,
          content: "系统升级，提前保存好数据！",
          deadline: "2999-01-01 00:00:00",
          publishTime: "2024-07-08 16:19:46",
          publisher: "",
          roleName: "录入员,抄表员,收费员,分公司经理",
          status: 1,
          title: "升级提示"
        }],
      }
    },
    mounted() {
      this.getData()
    },
    beforeDestroy() {},
    created() {},
    methods: {
      getData() {
        // this.tableData=[{}]
      },
      pageSizeChange(data) {
        const self = this
        self.tablePagination.size = data
        self.getData()
      },
      currentPageChange(data) {
        const self = this
        self.tablePagination.current = data
        self.getData()
      },
      handlePageOperation(row, mark) {
        const self = this;
        if (mark == "edit") {
          // self.addDeviceVisible = true;
          // self.isAddDev = false;

          //给表单赋值......
        } else if (mark == "delete") {
          this.$confirm('确定要删除此记录吗?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            this.delectById(row.id);
          }).catch(() => {});
        }
      },
      delectById(id) { //删除
      },
    }
  }
</script>
<style lang="scss" scoped>

</style>